package com.fz.us.oa.web.controller.mp;


import com.fz.us.admin.company.service.UserService;
import com.fz.us.base.util.CommonUtil;
import com.fz.us.oa.web.controller.BaseController;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


/**
 * 控制器 - 登录
 * ============================================================================
 * 版权所有 2016 。
 *
 * @author fallenpanda
 * @version 1.0 2016-07-29 。
 * ============================================================================
 */
@Controller
@RequestMapping(value = "/mp/register")
public class RegisterController extends BaseController {

    private static final long serialVersionUID = 1455982887058698995L;


    @Autowired
    private UserService userService;

    @RequestMapping(value = "checkmobile", method = RequestMethod.POST)
    public Object checkmobile(Model model, String username) {

        if(!CommonUtil.isMobile(username.trim())){
            return ajaxJson(resultService.fail("请输入正确的手机号！"));
        }

        if(userService.getUserByMobile(username.trim())!=null){
            return ajaxJson(resultService.fail("已经存在该用户！"));

        }
        return ajaxJson(resultService.success());

    }



 }
